package com.sixth.controller;

import com.sixth.entity.Course;
import com.sixth.entity.Subject;
import com.sixth.service.SubjectService;
import com.sixth.until.CommonResult;
import com.sixth.until.TableResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @program: self-tui-education
 * @description:
 * @author: 老魏
 * @create: 2022-04-15 16:57
 * 课程分类页面
 **/
@RestController
@RequestMapping("core/subject")
public class SubjectController {
    @Autowired
    private SubjectService subjectService;
    //课程分类查询全部
    @PostMapping("findsubject/{pageCurrent}/{pageSize}")
    public TableResult findSubject(@PathVariable Integer pageCurrent, @PathVariable Integer pageSize, @RequestBody Subject subject){
        return subjectService.findSubject(pageCurrent,pageSize,subject);
    }
    //修改状态
    @PostMapping("changeStatusId")
    public CommonResult changeStatusId(String id){
        return  subjectService.changeStatusId(id);
    }
    //操作编辑
    @PostMapping("updatesubject")
    public CommonResult updateSubject(@RequestBody Subject subject){
        System.out.println(subject);
        return subjectService.updateSubject(subject);
    }
    //操作删除
    @PostMapping("deletesubject")
    public CommonResult deleteSubject(String id){
        System.out.println(id);
        return subjectService.deleteSubject(id);
    }
    //操作添加
    @PostMapping("insertsubject")
    public CommonResult insertSubject(@RequestBody Subject subject){
        System.out.println(subject);
        return subjectService.insertSubject(subject);
    }

}
